package com.tcm.order.domain.enums;

/**
 *
 * Created by biuco on 2020/3/5.
 */
public enum OrderStatusEnum {
    UNPAY(new Byte("1"), "未付款"),
    PAID(new Byte("2"), "已付款"),
    WAIT_STOCK(new Byte("3"), "待发货"),
    WAIT_CONFIRM(new Byte("4"), "待收货"),
    COMPLETED(new Byte("5"), "已完成"),
    //系统取消，卖家取消，买家取消都归为已关闭状态
    CANCELED(new Byte("6"), "已关闭");

    OrderStatusEnum(Byte code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private final Byte code;

    private final String msg;

    public Byte getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }


    /**
     * 判断定订单是否可退款
     * @return
     */
    public static boolean refundable(Byte orderStauts) {
        return orderStauts == WAIT_STOCK.getCode() || orderStauts == WAIT_CONFIRM.getCode();
    }

}
